package com.example.demo;

import com.deliveredtechnologies.rulebook.FactMap;
import com.deliveredtechnologies.rulebook.lang.RuleBookBuilder;
import com.deliveredtechnologies.rulebook.model.RuleBook;
import lombok.extern.slf4j.Slf4j;

/**
 * @author lizhien (zhien.li@nascent.cn)
 * @version 1.0.0
 * @date 2022/3/18 16:02
 * @description com.example.demo
 */

@Slf4j
public class ExampleRule {

    public ExampleRule() {
        log.info("aaa");
    }

    public RuleBook<Object> defineHelloWorldRules() {
        return RuleBookBuilder.create()

            .addRule(rule -> rule.withNoSpecifiedFactType().then(f -> log.info("Hello ")))

            .addRule(rule -> rule.withNoSpecifiedFactType().then(f -> log.info("World")))

            .build();
    }

    public static void main(String args[]) {
        new ExampleRule().defineHelloWorldRules().run(new FactMap<>());
    }
}
